<template>
  <div>
    <NavBar>
      <template slot="content">
        <div>{{ navtitle }}</div>
      </template>
    </NavBar>
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <div class="c-review-list-item">
        <!-- <div
          class="review-list-item"
          v-for="item in list"
          :key="item.index"
          @click="handleMenu(item)"
        >
          <div class="flex-row">
            <div class="review-list-item-left">
              <img :src="item.videoLogoPath" />
            </div>
            <div class="review-list-item-right">
              <div class="review-list-item-right-title">
                {{ item.videoName }}
              </div>
              <div class="review-list-item-right-time">
                <div>{{ item.publishTime }}</div>
                <div>{{ item.person }}</div>
                <div class="review-list-item-right-share">
                  播放量： {{ item.clickNumber }}
                </div>
              </div>
            </div>
          </div>
        </div> -->
        <van-row class="page-padding-7">
          <van-col
            span="12"
            v-for="item in list"
            :key="item.index"
            @click="handleMenu(item)"
            class="page-padding-col"
          >
            <img :src="item.videoLogoPath" class="review-list-item-img" />

            <!-- <div class="page-padding-7"> -->
            <div class="review-list-item-desc">{{ item.videoName }}</div>
            <div class="review-list-item-time">
              <p class="review-list-item-time-text">{{ item.publishTime }}</p>
              <p class="review-list-item-time-text">播放量:{{ item.clickNumber }}</p>
            </div>
            <!-- <div class="review-list-item-number"></div> -->
            <!-- </div> -->
          </van-col>
        </van-row>
      </div>
    </van-list>
  </div>
</template>
<script>
import NavBar from '@/components/h5header'
import API from '@/services/h5/review'
export default {
  components: { NavBar },
  data() {
    return {
      navtitle: '',
      list: [],
      curPage: 0,
      length: 10,
      loading: false,
      finished: false
    }
  },
  created() {
    this.navtitle = this.$route.query.videoName
      ? this.$route.query.videoName
      : '回放列表'
  },
  methods: {
    async onLoad() {
      this.curPage += 1
      this.loading = true
      this.finished = false
      let params = {
        length: this.length,
        curPage: this.curPage,
        videoName: this.$route.query.videoName,
        videoType: this.$route.query.videoType
      }
      const res = await API.getplaybackList(params)
      if (res && res.data && res.data.code === 1000) {
        this.list = this.list.concat(res.data.data.list)
        if (this.list.length < res.data.data.count) {
          this.loading = false
        } else {
          this.loading = false
          this.finished = true
          return
        }
      }
    },
    handleMenu(item) {
      this.$router.push({
        path: '/reviewDetail',
        query: {
          ...item
        }
      })
    }
  }
}
</script>
<style scoped lang="less">
.c-review-list-item {
  margin-top: 20px;
  .review-list-item {
    margin-bottom: 30px;
    padding: 0 15px;
  }
}
.review-list-item-left {
  width: 115px;
  height: 70px;
  border-radius: 4px;
  box-shadow: rgba(0, 0, 0, 0.05) 0 0 8 0;
  img {
    width: 115px;
    height: 70px;
  }
}
.review-list-item-right {
  margin-left: 13px;
  &-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }
  &-time {
    margin-top: 8px;
    font-size: 13px;
    color: #999;
    div {
      display: inline-block;
    }
    div:last-child {
      margin-left: 13px;
    }
  }
  &-share {
    color: #ccc;
    font-size: 11px;
    margin-top: 8px;
  }
}
.page-padding-7 {
  padding: 0 7px;
}
.page-padding-col {
  position: relative;
  padding: 2px 7px;
}
.review-list-item-img {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 211px;
}
.review-list-item-number {
  color: #ccc;
  font-size: 11px;
  margin-top: 5px;
}
.review-list-item-desc {
  /* font-size: 18px;
  font-weight: bold;
  color: #333; */
  font-size: 13px;
  color: #666;
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-list-item-time {
  font-size: 13px;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.review-list-item-time-text {
  margin-top: 0;
}
</style>
